//
//  HBHMainBusinessCell.m
//  HubeiHotel
//
//  Created by 张露杰 on 17/11/15.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "HBHMainBusinessCell.h"

@implementation HBHMainBusinessCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    //    继承父类
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
    }
    return self;
}

-(void)loadCellWithData:(NSDictionary *)data
{
    //    重新布局
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
//      [cell loadCellWithData:@{@"title":@"汉街万达招商",@"sub":@"中国第一，世界一流，业内朝拜之地",@"adress":@"武昌区公正路1号"}];
    NSString *title = [ToolViewVC getNotNullStr:data[@"name"]];
    NSString *sub = [ToolViewVC getNotNullStr:[ToolViewVC getNotDic:data[@"classification"]][@"name"]];
    NSString *adress = [NSString stringWithFormat:@"%@%@",[ToolViewVC getNotNullStr:[ToolViewVC getNotDic:data[@"area"]][@"name"]],[ToolViewVC getNotNullStr:[ToolViewVC getNotDic:data[@"tradingArea"]][@"name"]]];
    
    UIImageView *imageV = [TomamaUI createImageView:CGRectMake(15*screenW_6, 20*screenW_6, 107.5*screenW_6, 75*screenW_6) backGroundImageV:@""];
    [imageV sd_setImageWithURL:[NSURL URLWithString:data[@"image"]] placeholderImage:[UIImage imageNamed:@"Main_business"]];
    [self.contentView addSubview:imageV];
    
    UILabel *titleLabel = [TomamaUI createLabel:CGRectMake(CGRectGetMaxX(imageV.frame) + 14*screenW_6, imageV.frame.origin.y, SCREENW - CGRectGetMaxX(imageV.frame) - 29*screenW_6, 17*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:17*screenW_6] textColor:TextBlack text:title];
    [self.contentView addSubview:titleLabel];
    
    UILabel *subLabel = [TomamaUI createLabel:CGRectMake(titleLabel.frame.origin.x, CGRectGetMaxY(titleLabel.frame) + 10*screenW_6, titleLabel.frame.size.width, 24*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:14*screenW_6] textColor:TextGray text:sub];
    [self.contentView addSubview:subLabel];
    
    UIImageView *icon = [TomamaUI createImageView:CGRectMake(titleLabel.frame.origin.x, CGRectGetMaxY(subLabel.frame) + 10*screenW_6, 9*screenW_6, 12*screenW_6) backGroundImageV:@"Main_navi"];
    [self.contentView addSubview:icon];
    UILabel *adressLabel = [TomamaUI createLabel:CGRectMake(CGRectGetMaxX(icon.frame) + 7*screenW_6, 0, SCREENW - CGRectGetMaxX(icon.frame) - 22*screenW_6, 13*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:13*screenW_6] textColor:[UIColor colorWithHexString:@"#666666"] text:adress];
    [self.contentView addSubview:adressLabel];
    adressLabel.center = CGPointMake(adressLabel.center.x, icon.center.y);
    
    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 115*screenW_6 - .5, SCREENW, .5)];
    lineView.backgroundColor = backColor;
    [self.contentView addSubview:lineView];
}
@end
